//
//  ShopTabBar.m
//  BaseFrame
//
//  Created by 吕金状 on 2017/6/23.
//  Copyright © 2017年 com.mxh. All rights reserved.
//

#import "ShopTabBar.h"

@interface ShopTabBar ()

@property (nonatomic,strong) UIView *bgView;


@end

@implementation ShopTabBar

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.bgView = [UIView new];
        self.bgView.backgroundColor = [UIColor whiteColor];
//        self.bgView.layer.masksToBounds = YES;
//        self.bgView.layer.cornerRadius = 4;
        self.bgView.size = CGSizeMake(40, 40);
//        self.layer.shadowColor = [UIColor blackColor].CGColor;
//        self.layer.shadowRadius= 4;
//        self.layer.shadowOpacity = .5;
        
        [self addSubview:self.bgView];
        
        UIButton *plusBtn = [[UIButton alloc] init];
        [plusBtn setBackgroundImage:[UIImage imageNamed:@"out"] forState:UIControlStateNormal];
        [plusBtn setBackgroundImage:[UIImage imageNamed:@"out"] forState:UIControlStateSelected];
        [plusBtn setImage:[UIImage imageNamed:@"out"] forState:UIControlStateNormal];
        [plusBtn setImage:[UIImage imageNamed:@"out"] forState:UIControlStateSelected];
        plusBtn.size = CGSizeMake(36, 36);
        plusBtn.userInteractionEnabled = NO;
        //        plusBtn.layer.masksToBounds = YES;
        //        plusBtn.layer.cornerRadius = 3;
        //        plusBtn.layer.shadowColor = [UIColor blackColor].CGColor;
        //        plusBtn.layer.shadowRadius = 5;
        //        plusBtn.layer.shadowOpacity = 1;
        
        [self addSubview:plusBtn];
        self.plusBtn = plusBtn;
//        self.titleLabel = [UILabel new];
//        self.titleLabel.text = @"扫一扫";
//        self.titleLabel.font = DEF_FontSize_10;
//        self.titleLabel.textAlignment = NSTextAlignmentCenter;
//        self.titleLabel.textColor = getColor(@"303030");
//        [self addSubview:self.titleLabel];
    }
    return self;
}



/**
 *  想要重新排布系统控件subview的布局，推荐重写layoutSubviews，在调用父类布局后重新排布。
 */
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    // 1.设置加号按钮的位置
    self.plusBtn.centerX = self.width*0.5;
    self.plusBtn.centerY = self.height*0.5;
    self.bgView.centerX = self.width*0.5;
    self.bgView.centerY = self.height*0.5;
    
    self.titleLabel.frame = CGRectMake(CGRectGetMinX(self.plusBtn.frame)-20, 49-18, self.plusBtn.frame.size.width+40, 18);
    
}
@end
